package app

import (
	"back/app/controller"
	middlewares "back/app/middleware"
	"github.com/gin-gonic/gin"
)

func RegisterRouters(app *gin.Engine) {
	user := controller.User{}
	admin := controller.Admin{}
	app.POST("/login", user.LoginHandler)
	app.POST("/register", user.RegisterHandler)
	app.POST("/send_code", user.SecureCodeHandler)
	app.POST("/verify", user.VerifyCodeHandler)
	app.POST("/check_user_info", middlewares.Auth(), user.UserInfoHandler)
	app.POST("/change_user_pwd", user.ChangePwdHandler)
	app.POST("/change_user_pwd2", middlewares.Auth(), user.ChangePwdHandler2)
	app.POST("/change_user_info", middlewares.Auth(), user.ChangeInfoHandler)
	app.POST("/check_user_movementlist", middlewares.Auth(), user.MovementListHandler)
	app.POST("/check_user_movement", middlewares.Auth(), user.MovementAmpPhaseHandler)
	app.POST("/go_py", middlewares.Auth(), user.GoPyHandler)
	app.POST("/upload", middlewares.Auth(), user.UploadHandler)
	app.GET("/check_headportrait", middlewares.Auth(), user.HeadPortraitListHandler)
	app.POST("/statistics", middlewares.Auth(), user.StatisticsHandler)
	app.POST("/feedback", middlewares.Auth(), user.FeedbackHandler)
	app.POST("/user_check_feedback", middlewares.Auth(), user.UserCheckFeedbackHandler)
	app.POST("/check_reply", middlewares.Auth(), user.CheckReplyHandler)
	app.POST("/apply_manager", middlewares.Auth(), user.ApplyManagerHandler)
	app.POST("/del_file", middlewares.Auth(), user.DelFileHandler)
	app.GET("/menu", middlewares.Auth(), user.MenuHandler)

	//以下是管理员页面路由
	app.POST("/adduser", middlewares.Auth(), admin.AddUserHandler)
	app.POST("/removeuser", middlewares.Auth(), admin.RemoveUserHandler)
	app.POST("/delUser", middlewares.Auth(), admin.DelUserHandler)
	app.POST("/check_feedback", middlewares.Auth(), admin.CheckFeedbackHandler)
	app.POST("/check_user_list", middlewares.Auth(), admin.CheckUserListHandler)
	app.POST("/remove_manager", middlewares.Auth(), admin.RemoveManagerHandler)
	app.POST("/add_manager", middlewares.Auth(), admin.AddManagerHandler)
	app.POST("/reply_feedback", middlewares.Auth(), admin.ReplyFbHandler)
	app.POST("/check_apply_list", middlewares.Auth(), admin.CheckApplyListHandler)
	app.POST("/check_manager_list", middlewares.Auth(), admin.CheckManagerListHandler)
	app.POST("/check_all_list", middlewares.Auth(), admin.CheckAllUserListHandler)
	app.POST("/check_login_logger", middlewares.Auth(), admin.CheckLoginLoggerListHandler)
}
